package com.it.bigdata.util;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.Table;

import java.io.IOException;

public class HbaseUtil {
    private HbaseUtil() {
    }

    private static final Configuration conf = HBaseConfiguration.create();

    static {
        conf.set("hbase.zookeeper.quorum", "node3:2181,node4:2181,node5:2181");
    }

    /**
     * 获取连接对象
     */
    public static Connection getConn() {
        try {
            Connection conn = ConnectionFactory.createConnection(conf);
            return conn;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
